import re
import string
+import os
from xen.util import blkif
import xen.util.xsm.xsm as security
"""
DevController.__init__(self, vm)
+ def _isValidProtocol(self, protocol):
+ if protocol in ('phy', 'file', 'tap'):
+ return True
+
+ return os.access('/etc/xen/scripts/block-%s' % protocol, os.X_OK)
+
+
def getDeviceDetails(self, config):
"""@see DevController.getDeviceDetails"""
uname = config.get('uname', '')
else:
try:
(typ, params) = string.split(uname, ':', 1)
- if typ not in ('phy', 'file', 'tap'):
- raise VmError(
- 'Block device must have "phy", "file" or "tap" '
- 'specified to type')
+ if not self._isValidProtocol(typ):
+ raise VmError('Block device type "%s" is invalid.' % typ)
except ValueError:
raise VmError(
'Block device must have physical details specified')